<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="js/vue.js"></script>
</head>
<body>
    <div id="box">
        <p :style="{backgroundColor:bg,color:cg}">一段文本</p>
        <button @click="cg='white'">改变字体</button>

        <br>
        <br>
        <br>
        <br>
        <p :style="p_style">一段文本</p>
        <button @click="p_style.color='white'">改变字体</button>
    </div>

    <script>
        let vm = new Vue({
            el:"#box",
            data:{
                bg:"red",
                cg:"blue",
                p_style:{
                    backgroundColor:"orange",
                    color:"black",
                }
            }
        })
    </script>
</body>
</html>